﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.ComponentModel.Composition;
using ShredTheLog.Api;
using ShredTheLog.Common.MVVM;
using ShredTheLog.Views;
using ShredTheLog.ViewModels;
using System.Diagnostics;
using System.Windows.Media;
using ShredTheLog.Controls;

namespace ShredTheLog.Plugins
{
    [Export(typeof(ICommandListItem))]
    [MenuCommandMetadata(Menu = Menus.Help, Order = 0, Group = null)]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public sealed class GoToWebsiteCommand : DelegateCommand, IUiCommand
    {
        [Import]
        private IShredServices ShredServices { get; set; }

        public GoToWebsiteCommand()
            : base(() => Process.Start(@"http://shredthelog.codeplex.com/"))
        {
        }

        public string Name { get { return ShredServices.GetLocalizedString("s_Website"); } }
        public ImageSource Image { get { return null; } }
    }

    [Export(typeof(ICommandListItem))]
    [MenuCommandMetadata(Menu = Menus.Help, Order = 100, Group = null)]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public sealed class GoToForumCommand : DelegateCommand, IUiCommand
    {
        [Import]
        private IShredServices ShredServices { get; set; }

        public GoToForumCommand()
            : base(() => Process.Start(@"http://shredthelog.codeplex.com/Thread/List.aspx"))
        {
        }

        public string Name { get { return ShredServices.GetLocalizedString("s_Forum"); } }
        public ImageSource Image { get { return null; } }
    }

    [Export(typeof(ICommandListItem))]
    [MenuCommandMetadata(Menu = Menus.Help, Order = 200, Group = null)]
    [Export(typeof(IDiscoverSharedTalkCommand))]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public sealed class DiscoverSharedTalkCommand : DelegateCommand, IUiCommand, IDiscoverSharedTalkCommand
    {
        [Import]
        private IShredServices ShredServices { get; set; }

        public DiscoverSharedTalkCommand()
            : base(() => Process.Start(@"http://sharedtalk.com/"))
        {
        }

        public string Name { get { return ShredServices.GetLocalizedString("s_DiscoverSharedTalk"); } }
        public ImageSource Image { get { return null; } }
    }

    [Export(typeof(ICommandListItem))]
    [MenuCommandMetadata(Menu = Menus.Help, Order = 300, Group = AboutCommandGroup)]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public sealed class ShowAboutCommand : DelegateCommand, IUiCommand
    {
        [Import]
        private IShredServices ShredServices { get; set; }

        public const string AboutCommandGroup = "About";

        public ShowAboutCommand()
            : base(() => new AboutView().Show(new AboutViewModel()))
        {
        }

        public string Name { get { return ShredServices.GetLocalizedString("s_About"); } }
        public ImageSource Image { get { return null; } }
    }
}
